const globalModules = {
  state: {
    isSdkReady: false,
    isCalling: false,
	networkStatus:'connected', //disconnected connecting connected
    rtcConfig: {},
	systemInfo:{},
	serverConfig:{},
	emoJiInfo:{}
  },
  getters: {
    isSdkReady: state => state.isSdkReady,
    isCalling: state => state.isCalling,
    rtcConfig: state => state.rtcConfig,
	systemInfo: state => state.systemInfo,
	networkStatus: state => state.networkStatus,
	serverConfig: state => state.serverConfig,
	emoJiInfo: state => state.emoJiInfo,
  },
  mutations: {
    showToast (state, payload) {
      wx.showToast({
        title: payload.title,
        icon: payload.icon || 'none',
        duration: payload.duration || 800
      })
	  
    },
    setSdkReady (state, payload) {
      state.isSdkReady = payload
    },
    setCalling (state, payload) {
      state.isCalling = payload
    },
    setRtcConfig (state, payload) {
      state.rtcConfig = payload
    },
	setSystemInfo (state, payload) {
	  state.systemInfo = payload
	},
	setNetworkStatus (state, payload) {
	  state.networkStatus = payload.state
	},
	setServerConfig (state, payload) {
	  state.serverConfig = payload
	},
	setEmoJiInfo(state, payload){
		state.emoJiInfo = payload
	}
	
  },
  actions: {
    resetStore (context) {
      context.commit('resetGroup')
      context.commit('resetUser')
      context.commit('resetCurrentConversation')
      context.commit('resetAllConversation')
    }
  }
}

export default globalModules
